package com.wang.springbootinit.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.wang.springbootinit.model.dto.question.QuestionAddRequest;
import com.wang.springbootinit.model.dto.question.QuestionUpdateRequest;
import com.wang.springbootinit.model.entity.Question;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wang.springbootinit.model.dto.answer.SubmitAnswerRequest;
import com.wang.springbootinit.model.vo.AnswerAnalyzeDataVO;
import com.wang.springbootinit.model.vo.QuestionVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface QuestionService extends IService<Question> {

    /**
     * 学生分页获取题目
     * @param chapterId
     * @param questionType
     * @param questionCategory
     * @param current
     * @param pageSize
     * @return
     */
    Page<QuestionVO> getQuestionsByChapterPage(Long chapterId, Integer questionType, Integer questionCategory, long current, long pageSize,HttpServletRequest request);

    /**
     * 根据章节ID查询题目
     */
    List<Question> getQuestionsByChapter(Long chapterId, Integer type, Integer category);

    /**
     * 新增题目
     */
    Boolean addQuestion(QuestionAddRequest questionAddRequest);

    /**
     * 更新题目
     */
    Boolean updateQuestion(QuestionUpdateRequest questionUpdateRequest);

    /**
     * 提交答案
     * @param submitAnswerRequest 答案请求
     * @return 是否提交成功
     */
    Boolean submitAnswers(SubmitAnswerRequest submitAnswerRequest, HttpServletRequest request);

    List<Question> getByChapterId(Long chapterId);

    List<QuestionVO> listVOByIds(List<Long> questionIds);

    /**
     * 教师端-分页获取题目答题数据情况
     * @param chapterId
     * @param questionType
     * @param questionCategory
     * @param questionId
     * @param current
     * @param pageSize
     * @param request
     * @return
     */
    Page<AnswerAnalyzeDataVO> getAnswerTestDataPage(Long chapterId, Integer questionType, Integer questionCategory, Integer questionId, long current, long pageSize, HttpServletRequest request);
}
